package main

import (
	"context"
	"fmt"
	stlog "log"
	"strconv"
	"time"

	"hudiebbk.com/distributed/log"
	"hudiebbk.com/distributed/service"
)

func main() {
	year, m, day := time.Now().Date()
	log.Run(strconv.Itoa(year) + "-" + strconv.Itoa(int(m)) + "-" + strconv.Itoa(day) + "-distributed.log")
	host, port := "localhost", "4000"
	ctx, err := service.Start(
		context.Background(),
		"logService",
		host,
		port,
		log.RegisterHandlers,
	)
	if err != nil {
		stlog.Fatalln(err)
	}
	<-ctx.Done()
	fmt.Println("shutting down log service.")
}
